using System;
using System.Collections.Generic;
using System.Text;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using THSLib;using THSERP.BaseProvider;

namespace THSERP.Modules.DataExchange
{
    public class DataExchangeEntities : ERPModuleEntities
    {
        #region variables
        private THSList<BRBranchsInfo> lstBRBranchs;
        private THSList<BRPostingHistorysInfo> lstBRPostingHistory;
        #endregion

        #region Properties
        public THSList<BRBranchsInfo> BRBranchsList
        {
            get
            {
                return lstBRBranchs;
            }
            set
            {
                lstBRBranchs = value;
            }
        }

        public THSList<BRPostingHistorysInfo> BRPostingHistoryList
        {
            get
            {
                return lstBRPostingHistory;
            }
            set
            {
                lstBRPostingHistory = value;
            }
        }
        #endregion

        #region Constructore
        public DataExchangeEntities()
            : base()
        {
            lstBRBranchs = new THSList<BRBranchsInfo>();
            lstBRPostingHistory = new THSList<BRPostingHistorysInfo>();
        }
        #endregion

        #region Initalize Module list
        public override void InitModuleObjectList()
        {
            lstBRBranchs.InitTHSList(this, String.Empty, THSUtil.GetTableNameFromBusinessObjectType(typeof(BRBranchsInfo)));
            DataSet ds = new BRBranchsController().GetAllObjects();
            lstBRBranchs.Invalidate(ds);
            for (int i = 0; i < lstBRBranchs.Count; i++)
                if (lstBRBranchs[i].BRBranchID == THSApp.CurrentCompanyInfo.FK_BRBranchID)
                {
                    lstBRBranchs.RemoveAt(i);
                    break;
                }

            lstBRPostingHistory.InitTHSList(this, String.Empty, THSUtil.GetTableNameFromBusinessObjectType(typeof(BRPostingHistorysInfo)));
            ds = new BRPostingHistorysController().GetAllObjects();
            lstBRPostingHistory.Invalidate(ds);
        }
        #endregion

        #region Initalize GridControl
        public override void InitGridControlInTHSList()
        {
            lstBRBranchs.InitTHSListGridControl();
            lstBRPostingHistory.InitTHSListGridControl();
        }
        #endregion
    }
}
